<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<div id="app">
    <h1>{{getReverseMessage}}</h1>
    <h1>{{getReverseMessage}}</h1>

    <h1>{{getFullName}}</h1>
    <h1>{{getFullName}}</h1>

    <h1>{{getScoreRes}}</h1>
    <h1>{{getScoreRes}}</h1>
</div>
<script src="../../JavaScript/vue.js"></script>
<script>
    const app = Vue.createApp({
        data() {
            return {
                message: "hello Vue",
                firstName: "陶",
                lastName: "品奇",
                score: 60,
            }
        },
        computed: {
            // 计算属性的get函数
            getReverseMessage() {
                console.log("计算属性getReverseMessage被调用了")
                return this.message.split(" ").reverse().join(" ")
            },
            // 计算属性的get函数
            getFullName() {
                console.log("计算属性getFullName被调用了")
                return this.lastName + '' + this.firstName
            },
            // 计算属性的get函数
            getScoreRes() {
                console.log("计算属性getScoreRes被调用了")
                return this.score >= 60 ? '及格' : '不及格'
            }
        }
    })
    app.mount("#app")
</script>
</body>
</html>